<template>
	<!-- 投诉建议 -->
	<view class="body">
		<input class="textTwo" type="text" placeholder="请填写反馈内容" v-model="addData.description" />
		<view class="divLine"></view>
		<text>投诉类型</text>
		<view class="select">
			<uni-data-select v-model="value" :localdata="range" @change="change"></uni-data-select>
		</view>
		<view class="divLine"></view>
		<text>问题描述</text>
		<form name="my_form" method="POST">
			<textarea class="textOne" cols="8" rows="10" placeholder="请描述您的问题"></textarea>
		</form>
		<view class="divLine"></view>
		<text>投诉人姓名</text>
		<input class="input" type="text" placeholder="您的姓名" v-model="addData.complainant">
		<view class="divLine"></view>
		<text>手机号码</text>
		<input class="input" type="text" placeholder="您的电话号码" v-model="addData.phone">
		<view class="divLine"></view>
		<button @click="add">提交</button>
	</view>
</template>
<script>
	import {
		http
	} from "../../utils/http.js"
	export default {
		data() {
			return {
				addData: {
					phone: "",
					complainant: "",
					description: "",
					typeId: 1,
					communityId: 1
				},

				notice: [],
				
				value: 0,
				range: [{
						value: 0,
						text: "物业管理"
					},
					{
						value: 1,
						text: "维修管理"
					},
					{
						value: 2,
						text: "其他"
					},
				],
			};
		},
		methods: {
			change(e) {
				console.log("e:", e);
			},
			getData() {
				http({
					url: "/complaint/add",
					method: "post",
					data: {
						data: this.addData
					}
				}).then((res) => {
					// console.log(res)
					if (res.code == 0) {
						this.notice = res.data;
						console.log("添加成功")
					} else {
						console.log("添加失败")
					}

				})
			},
			add: function() {
				this.getData();
			},
		},

		onLoad() {
			this.getData();
		},
	};
</script>

<style>
	@import url('../../static/font/iconfont.css');

	textarea {
		/* border: solid 1px red; */
		margin-left: 200rpx;
	}

	.body {
		padding: 10rpx;
		display: flex;
		flex-direction: column;
	}

	.select {
		/* border: solid 1px red; */
		width: 300rpx;
		margin-left: 200rpx;
		margin-top: -50rpx;
	}

	.divLine {
		margin: 10rpx;
		margin-left: 20rpx;
		margin-right: 20rpx;
		background: #E0E3DA;
		width: 100%;
		height: 3rpx;
	}

	.textOne {
		margin-top: -40rpx;
		width: 500rpx;
	}

	.textTwo {
		margin-left: 20rpx;
		width: 700rpx;
	}

	text {
		float: left;
		margin-left: 20rpx;
		margin-top: 10rpx;
		/* border: solid 1px red; */
	}

	.input {
		margin-top: -45rpx;
		margin-left: 200rpx;
		/* border: solid 1px red; */
		width: 500rpx;
	}

	hr {
		margin-top: 20rpx;
		margin-left: 20rpx;
		margin-right: 20rpx;
		color: #987cb9;
		size: 1rpx;
	}

	button {
		margin-top: 40rpx;
		margin-left: 20rpx;
		margin-right: 20rpx;
		border-radius: 5px;
		background-color: blue;
		color: white;
	}
</style>
